//
//  BaseViewController.swift
//  DaRings
//
//  Created by 尹琼 on 2023/2/24.
//

import UIKit
import MYModule

open class BaseViewController: ViewController {

    open override func viewDidLoad() {
        super.viewDidLoad()

    }
    
    
    open override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        setLogScreenView()
    }
    
   open func setLogScreenView() {
       
       guard let AppName = Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String, AppName == "Da Rings" else {
           return
       }
       
        guard let screenType = self.screenNameType else { return }
        
        FireBaseManager.shared.logScreenView(screenName: screenType, screenClass: self)
        
    }
    
   open var screenNameType: FireBaseScreenNameType? {
        
        let clsStr = "\(self.classForCoder)"
        
        if clsStr == "ActivityHomeController" {
            return .homeActivity
        }
        
        if clsStr == "TrainingRecordsController" {
            return .workOutsList
        }
        
        if clsStr == "SleepViewController" {
            return .workOutsList
        }
        
        if clsStr == "HeartRateDetailController" {
            return .heartRateDetailPage
        }
        
        if clsStr == "SingleHeartRateDetailController" {
            return .singleHeartRateDetailPage
        }
        
        if clsStr == "BloodOxygenDetailController" {
            return .singleBloodOxyenDetailPage
        }
        
        if clsStr == "HRVDetailController" {
            return .singleHRVDetailPage
        }
        
        if clsStr == "StressDetailViewController" {
            return .singleStressDetailPage
        }
        
        if clsStr == "GoalSetupController" {
            return .setUpGoalPage
        }
        
        if clsStr == "FirmwareInformationController" {
            return .informationPage
        }
        
        if clsStr == "OtherController" {
            return .otherPage
        }
        
        if clsStr == "AppleHealthController" {
            return .appleHealthPage
        }
        
        
        if clsStr == "AboutusController" {
            return .aboutMyPage
        }
        
        if clsStr == "FirmwareUpgradeController" {
            return .OTAUpgratePage
        }
        
        if clsStr == "FirmwareInformationController" {
            return .firmwareInfoPage
        }
        
        if clsStr == "FirmwareResetController" {
            return .resetFirmwarePage
        }
        
        return nil
    }


}
